package mvc.Model.Bbs;

import java.util.List;

public class BbsDataMgr {
	public BbsDataDAO getDAO() {
		BbsDataDAO dao = new BbsDataDAO();
		return dao;
	}

	public int getCount(String keyColumn, String keyWord, String code) {
		int count = 0;
		try{
			count = getDAO().getCount(keyColumn, keyWord, code);
		}catch(Exception e){
			System.out.println(e.toString());
		}
		return count;
	}

	public List list(String keyColumn, String keyWord, int beginPerPage, int numPerPage, String code) {
		List list = null;
		
		try{
			list = getDAO().list(keyColumn,keyWord,beginPerPage,numPerPage,code);
		}catch(Exception e){
		    System.out.println(e.toString());
		}

		return list; 
	}

	public boolean create(BbsDataDTO dto) {
		boolean flag = false;
		
		try{
			flag = getDAO().create(dto);
		}catch(Exception e){
			System.out.println(e.toString());
		}
		
		return flag;
	}

	public BbsDataDTO read(int bSeq, String bbsCode) {
		BbsDataDTO dto = null;
		
		try{
			dto = getDAO().read(bSeq, bbsCode);
		}catch(Exception e){
			System.out.println(e.toString());
		}
		
		return dto;
	}

	public int getB_ID(String bbsCode) {
		int b_id = 0;
		
		try{
			b_id = getDAO().getB_ID(bbsCode);
		}catch(Exception e){
			System.out.println(e.toString());
		}
		
		return b_id;
	}

	public void uphit(int bSeq) {
		try{
			getDAO().uphit(bSeq);
		}catch(Exception e){
			System.out.println(e.toString());
		}
	}

	public boolean update(BbsDataDTO dto) {
		boolean flag = false;
		
		try{
			flag = getDAO().update(dto);
		}catch(Exception e){
			System.out.println(e.toString());
		}
		
		return flag;
	}

	public boolean remove(int bSeq, String bbsCode) {
		boolean flag = false;
		
		try{
			flag = getDAO().delete(bSeq, bbsCode);
		}catch(Exception e){
			System.out.println(e.toString());
		}
		
		return flag;
	}

	public double getSubID(double bSubid, String bbsCode) {
		double b_subid = 0;
		
		try{
			b_subid = getDAO().getSubID(bSubid, bbsCode);
		}catch(Exception e){
			System.out.println(e.toString());
		}
		
		return b_subid;
	}

	public boolean reply(BbsDataDTO dto) {
		boolean flag = false;
		
		try{
			flag = getDAO().reply(dto);
		}catch(Exception e){
			System.out.println(e.toString());
		}
		
		return flag;
	}

	public List toplist(String bbsCode) {
		List toplist = null;
		
		try{
			toplist = getDAO().toplist(bbsCode);
		}catch(Exception e){
		    System.out.println(e.toString());
		}

		return toplist; 
	}

	public boolean sel_remove(List<Integer> arrBSeq) {
		boolean flag = false;
		try{
			flag = getDAO().sel_remove(arrBSeq);
		}catch(Exception e){
			System.out.println(e.toString());
		}
		return flag;
	}


}
